package com.controller;

import com.entity.RbacManager;
import com.entity.ResponseEntity;
import com.service.RbacManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/rbacManager")
public class RbacManaerController {
    @Autowired
    private RbacManagerService rbacManagerService;
    @GetMapping("/User")
    public ResponseEntity findAll(){
        return rbacManagerService.findAll();
    }
    @GetMapping("/User/{id}")
    public ResponseEntity findOne(@PathVariable int id){
        return rbacManagerService.findOne(id);
    }
    @PostMapping("/User")
    public ResponseEntity add(@RequestBody RbacManager rbacManager){
        return rbacManagerService.addOne(rbacManager);
    }
    @DeleteMapping("/User/{id}")
    public ResponseEntity delete(@PathVariable int id){
        return rbacManagerService.deleteOne(id);
    }
    @PutMapping(value = "/User",produces = "text/html;charset=utf-8")
    public ResponseEntity updateOne(@RequestBody RbacManager rbacManager){
        return rbacManagerService.updateOne(rbacManager);
    }
}
